﻿using System.IO;
using Newtonsoft.Json;

namespace Tisonet.Dobrak.Client.WP8.Helpers
{
    public static class JsonSerializerHelper
    {
        public static T Deserialize<T>(Stream stream)
        {
            using (var streamReader = new StreamReader(stream))
            {
                using (var jsonReader = new JsonTextReader(streamReader))
                {
                    var serializer = new Newtonsoft.Json.JsonSerializer();
                    return serializer.Deserialize<T>(jsonReader);
                }
            }
        }
    }
}
